{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Cumulative Wikipedia Donations\n",
    "==============================\n",
    "\n",
    "This chart shows cumulative donations to Wikipedia over the past 10 years.\n",
    "his chart was inspired by this [reddit post](https://www.reddit.com/r/dataisbeautiful/comments/7guwd0/cumulative_wikimedia_donations_over_the_past_10/) but using lines instead of areas.\n",
    "Data comes from https://frdata.wikimedia.org/.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "\n",
    "data = \"https://frdata.wikimedia.org/donationdata-vs-day.csv\"\n",
    "\n",
    "alt.Chart(data).mark_line().encode(\n",
    "    alt.X(\n",
    "        'date:T', timeUnit='monthdate',\n",
    "        axis=alt.Axis(format='%B', title='Month')\n",
    "    ),\n",
    "    alt.Y(\n",
    "        'max(ytdsum):Q', stack=None,\n",
    "        axis=alt.Axis(title='Cumulative Donations')\n",
    "    ),\n",
    "    alt.Color('date:O', timeUnit='year', legend=alt.Legend(title='Year')),\n",
    "    alt.Order('data:O', timeUnit='year')\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
